Re: Extended query: prepared statements list? - Mailing list pgsql-novice

From M. Bastin
Subject Re: Extended query: prepared statements list?
Date
Msg-id a06110400bd1c7622ce7b@[192.168.0.101]
Whole thread Raw
In response to Re: Extended query: prepared statements list?  (Oliver Fromme <olli@lurza.secnetix.de>)
Responses Re: Extended query: prepared statements list?
List pgsql-novice
Hi Oliver,

>  > I only wish there were more documentation about the extended query
>  > language.  All I've found on the whole internet would hold on 2 to 3
>  > printed pages.  Did I miss something?)
>
>I'm not sure what exactly you are missing, but the page
>documenting the PREPARE statement (in the official Postgres
>docs) pretty much says it all.  Also, it's easy to find
>(Docs -> Reference -> SQL Commands -> PREPARE).
>
>http://www.postgresql.org/docs/7.4/static/sql-prepare.html
>
>However, maybe we're actually talking about completely
>different things

Yes and no.  I'm looking at the subject from the frontend-backend
protocol 3.0 point of view which is separated in the Extended Query
language and the Simple Query language.

With the PREPARE and EXECUTE statements you're accessing the Extended
Query language through the Simple Query language, which requires more
CPU time since your EXECUTE query itself is going to be parsed as a
Simple Query first before PostgreSQL realizes it must execute a
prepared statement, while when you send the commands directly through
the Extended Query language you skip that parsing step.

Plus the Extended Query language is far richer than just preparing
and executing even though these 2 operations will probably cover most
needs.  The Extended Query language is also much more complex to use.
E.g. you would do the EXECUTE by issuing about 5 commands--but it's
still much faster.  That's where I had problems and wished for more
documentation and/or examples.

I hope this clears up the confusion.

Cheers,

Marc

pgsql-novice by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Critique needed for contact-DB draft
Next
From: "Felix E. Klee"
Date:
Subject: Re: Critique needed for contact-DB draft